function updateUser() {
    var selected = $("#userTable").bootstrapTable('getSelections');
    var selected_length = selected.length;
    var _title = $MB.i18n('user.update'),
        _status1 = $MB.i18n('user.actived'),
        _status2 = $MB.i18n('user.locked'),
        _tips1 = $MB.i18n('tips.edit.user'),
        _tips2 = $MB.i18n('tips.edit.user.msg');
    if (!selected_length) {
        $MB.n_warning(_tips1);
        return;
    }
    if (selected_length > 1) {
        $MB.n_warning(_tips2);
        return;
    }
    var userId = selected[0].userId;
    $.post(ctx + "user/getUser", {"userId": userId}, function (r) {
        if (r.code === 0) {
            var $form = $('#user-add');
//            var $deptTree = $('#deptTree');
            $form.modal();
            var user = r.msg;
//            $form.find(".user_password").hide();
            $("#user-add-modal-title").html(_title);
            $form.find("input[name='username']").val(user.username).attr("readonly", true);
            $form.find("input[name='oldusername']").val(user.username);
            $form.find("input[name='userId']").val(user.userId);
            $form.find("input[name='email']").val(user.email);
            $form.find("input[name='mobile']").val(user.mobile);
            $form.find('input[name="validTimeStr"]').val(user.validTimeStr);
            $form.find('input[name="passwordUpdateTimeStr"]').val(user.passwordUpdateTimeStr);
            $form.find("input[name='password']").val("");
            
            
            /*if (util.common.getDateTime(user.passwordUpdateTimeStr) < (new Date().getTime())) {
            	//$('#passwordUpdateTimeStr').html(user.passwordUpdateTimeStr + '<em id="j-pwd-reset" class="btn btn-save">'+ $MB.i18n('user.password.reset') +'</em>');
            	$form.find('input[name="passwordUpdateTimeStr"]').after('<em id="j-pwd-reset" class="btn btn-save">'+ $MB.i18n('user.password.reset') +'</em>');
            } else {
            	$('#passwordUpdateTimeStr').text(user.passwordUpdateTimeStr);
            }*/
            var roleArr = [];
            $form.find("select[name='rolesSelect']").multipleSelect('uncheckAll');
            for (var i = 0; i < user.roleIds.length; i++) {
                roleArr.push(user.roleIds[i]);
            }
            $form.find("select[name='rolesSelect']").multipleSelect('setSelects', roleArr);
            $form.find("input[name='roles']").val($form.find("select[name='rolesSelect']").val());
            var $status = $form.find("input[name='status']");
            $status.prop("checked", user.status === '1' ? true : false);
            $status.parent().next().html( user.status === '1' ? _status1 : _status2 );
            $("input:radio[name='ssex'][value='" + user.ssex + "']").prop("checked", true);
            $("input:radio[name='deptId'][value='" + user.deptId + "']").prop("checked", true);
//            $deptTree.jstree().open_all();
//            $deptTree.jstree('select_node', user.deptId, true);
            $("#user-add-button").attr("name", "update");
        } else {
            $MB.n_danger(r.msg);
        }
    });
    
    $(document).on('click', '#j-pwd-reset' , function() {
		var _date = (new Date()).setMonth(new Date().getMonth() + 3) / 1000;
		var _dateStr = util.common.getDateStr(_date,'yyyy-MM-dd');
		$('#user-add').find('input[name="passwordUpdateTimeStr"]').val(_dateStr);
		//$('#passwordUpdateTimeStr').text(_dateStr);
	})
}